<template>
    <div class="main-wapper">
        <div v-if="error.statusCode === 404 || error.statusCode === 400">
            <template>
                <a-result status="404"
                          title="404"
                          sub-title="Sorry, the page you visited does not exist.">
                    <template #extra>
                        <a-button type="primary"
                                  @click="toGoHome()">
                            Back Home
                        </a-button>
                    </template>
                </a-result>
            </template>
        </div>
        <div v-else>
            <template>
                <a-result status="500"
                          title="500"
                          sub-title="Sorry, the server is wrong.">
                    <template #extra>
                        <a-button type="primary"
                                  @click="toGoHome()">
                            Back Home
                        </a-button>
                    </template>
                </a-result>
            </template>
        </div>

    </div>
</template>

<script>
export default {
    props: ['error'],
    methods: {
        toGoHome() {
            let redirect = this.$route.query.redirect;
            console.log("redirect == " + redirect);
            if (redirect) {
                location.href = redirect;
            } else {
                location.href = "/";
            }
        }
    },
}
</script>
<style lang="less" scoped>
.main-wapper {
    margin: 10px auto;
    max-width: 1249px;
    background: #fff;
}
</style>